<?php

class login{
public function index()
{
require_once APP_ROOT_PATH.'system/libs/user.php';
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$result = do_login_user($email,$pwd);
if($result['status'])
{
$user_data = es_session::get('user_info');
$root['return'] = 1;
$root['user_login_status'] = 1;
$root['info'] = '用户登陆成功';
$root['uid'] = $user_data['id'];
$root['user_name'] = $user_data['user_name'];
$root['user_email'] = $user_data['email'];
$root['user_money'] = $user_data['money'];
$root['user_score'] = $user_data['score'];
$root['user_money_format'] = format_price($user_data['money']);
$root['home_user']['fans'] = $user_data['focused_count'];
$root['home_user']['photos'] = $GLOBALS['db']->getOne('select count(*) from '.DB_PREFIX.'topic_image where user_id = '.$user_data['id']);
$root['home_user']['goods'] = $GLOBALS['db']->getOne('select count(*) from '.DB_PREFIX.'topic where user_id = '.$user_data['id']." and topic_group = 'Fanwe' and is_delete = 0 and is_effect = 1");
$root['home_user']['follows'] = $user_data['focus_count'];
$root['home_user']['favs'] = $GLOBALS['db']->getOne('select count(*) from '.DB_PREFIX.'topic where user_id = '.$user_data['id'].' and fav_id <> 0');
$root['home_user']['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'],'big'));
$root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'],'big'));
}
else
{
if($result['data'] == ACCOUNT_NO_EXIST_ERROR)
{
$err = '会员不存在';
}
if($result['data'] == ACCOUNT_PASSWORD_ERROR)
{
$err = '密码错误';
}
if($result['data'] == ACCOUNT_NO_VERIFY_ERROR)
{
$err = '会员未通过验证';
}
$root['return'] = 0;
$root['user_login_status'] = 0;
$root['info'] = $err;
$root['uid'] = 0;
$root['user_name'] = $email;
$root['user_email'] = $email;
}
output($root);
}
}

?>